//-----------------------------------------------------------------------------
// Bend2D - Physics Engine
// Roberto Bender <beto.bender@gmail.com>
// Description: 
// Date: 08/03/2010
//-----------------------------------------------------------------------------
#ifndef POINT_H
#define POINT_H

#include "angle.h"
#include "serializer.h"

namespace bend2d
{
    // TODO Rename to Vector

    class Point :
        public Serializer
	{
	public:
		Point();
		Point(double x, double y);
        Point(double mag);
        Point(double mag, const Angle& angle);
		double GetX() const;
		double GetY() const;
		double GetMag() const;
        const Angle& GetAngle() const;
        void SetXY(double x, double y);
        void SetX(double x);
		void SetY(double y);
        void SetMag(double mag);
        void SetAngle(const Angle& angle);
		Point operator + (const Point& point) const;
		Point operator - (const Point& point) const;
        Point operator * (double value) const;
		void operator += (const Point& point);
		void operator -= (const Point& point);
        bool operator < (const Point& point) const;
        void Sum(const Point& point, double scale);

        string ToString() const;
	private:
		double m_X;
		double m_Y;
        double m_Mag;
        Angle m_Angle;

        void CalculateFromXY();
        void CalculateFromMagAngle();
	};
}

#endif
